﻿#ifndef		__CHAOSFRAMEPERSECOND_HPP
#define		__CHAOSFRAMEPERSECOND_HPP

#include "ChaosGlobalDefine.hpp"


namespace Chaos
{
	/*! \class ChaosFramePerSecond
	* \author sniperbat
	* \date 2007-6
	* \brief 帧数更新计算
	*/
	class CHAOS_API ChsFramePerSecond
	{
	public:
		/*! \fn static void	Update()
		* \brief 每帧调用一次，更新帧计数器。
		*/
		static		void				Update();
		/*! \fn static	float	GetFPS()
		* \brief 得到当前的FPS数。
		*/
		static	inline float				GetFPS();
		/*! \fn static	float	GetAverageFPS()
		* \brief 得到平均的FPS数。
		*/
		static	inline	float				GetAverageFPS();
		/*! \fn static	float	GetMaxFPS()
		* \brief 得到最大FPS数。
		*/
		static	inline	float				GetMaxFPS();
	private:

		static		int					ms_nLastTime;
		static		int					ms_nCnt;
		static		int					ms_nAveCnt;
		static		int					ms_nSecondTime;
		static		float				ms_fCurFps;
		static		float				ms_fAveFps;
		static		float				ms_fTotalFps;
		static		float				ms_fMaxFps;

	};
	inline float ChsFramePerSecond::GetFPS()
	{
		return ms_fCurFps;
	}

	inline float ChsFramePerSecond::GetAverageFPS()
	{
		return ms_fAveFps;
	}

	inline float ChsFramePerSecond::GetMaxFPS()
	{
		return ms_fMaxFps;
	}

}

#endif		//__CHAOSFRAMEPERSECOND_HPP
